<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>帮助 | STAT HUB</title>
	<link type="text/css" rel="stylesheet" href="resource/css/framework.css" />
	<link type="text/css" rel="stylesheet" href="resource/css/main.css" />
	<link type="text/css" rel="stylesheet" href="resource/css/jquery.alerts.css" media="screen" />
	<script type="text/javascript" src="resource/javascript/jquery.min.js"></script>
	<script type="text/javascript" src="resource/javascript/jquery-ui.min.js"></script>
	<script type="text/javascript" src="resource/javascript/jquery.alerts.js"></script>
	<script type="text/javascript" src="resource/javascript/stathub.js"></script>
<style>
@font-face {
  font-family: octicons-anchor;
  src: url(data:font/woff;charset=utf-8;base64,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) format('woff');
}

body {
  background-color: white;
}

.markdown-body {
  min-width: 200px;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px;

  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  color: #333;
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
}

.markdown-body a {
  background: transparent;;word-wrap: break-word; word-break: break-all;
}

.markdown-body a:active,
.markdown-body a:hover {
  outline: 0;
}

.markdown-body strong {
  font-weight: bold;
}

.markdown-body h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

.markdown-body img {
  border: 0;
}

.markdown-body hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  height: 0;
}

.markdown-body pre {
  overflow: auto;
}

.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
  font-family: monospace, monospace;
  font-size: 1em;
}

.markdown-body input {
  color: inherit;
  font: inherit;
  margin: 0;
}

.markdown-body html input[disabled] {
  cursor: default;
}

.markdown-body input {
  line-height: normal;
}

.markdown-body input[type="checkbox"] {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  padding: 0;
}

.markdown-body table {
  border-collapse: collapse;
  border-spacing: 0;
}

.markdown-body td,
.markdown-body th {
  padding: 0;
}

.markdown-body * {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.markdown-body input {
  font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

.markdown-body a {
  color: #4183c4;
  text-decoration: none;
}

.markdown-body a:hover,
.markdown-body a:focus,
.markdown-body a:active {
  text-decoration: underline;
}

.markdown-body hr {
  height: 0;
  margin: 15px 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ddd;
}

.markdown-body hr:before {
  display: table;
  content: "";
}

.markdown-body hr:after {
  display: table;
  clear: both;
  content: "";
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 15px;
  margin-bottom: 15px;
  line-height: 1.1;
}

.markdown-body h1 {
  font-size: 30px;
}

.markdown-body h2 {
  font-size: 21px;
}

.markdown-body h3 {
  font-size: 16px;
}

.markdown-body h4 {
  font-size: 14px;
}

.markdown-body h5 {
  font-size: 12px;
}

.markdown-body h6 {
  font-size: 11px;
}

.markdown-body blockquote {
  margin: 0;
}

.markdown-body ul,
.markdown-body ol {
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.markdown-body ol ol,
.markdown-body ul ol {
  list-style-type: lower-roman;
}

.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
  list-style-type: lower-alpha;
}

.markdown-body dd {
  margin-left: 0;
}

.markdown-body code {
  font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.markdown-body pre {
  margin-top: 0;
  margin-bottom: 0;
  font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.markdown-body kbd {
  background-color: #e7e7e7;
  background-image: -webkit-linear-gradient(#fefefe, #e7e7e7);
  background-image: linear-gradient(#fefefe, #e7e7e7);
  background-repeat: repeat-x;
  border-radius: 2px;
  border: 1px solid #cfcfcf;
  color: #000;
  padding: 3px 5px;
  line-height: 10px;
  font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
  display: inline-block;
}

.markdown-body>*:first-child {
  margin-top: 0 !important;
}

.markdown-body>*:last-child {
  margin-bottom: 0 !important;
}

.markdown-body .anchor {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: block;
  padding-right: 6px;
  padding-left: 30px;
  margin-left: -30px;
}

.markdown-body .anchor:focus {
  outline: none;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  position: relative;
  margin-top: 1em;
  margin-bottom: 16px;
  font-weight: bold;
  line-height: 1.4;
}

.markdown-body h1 .octicon-link,
.markdown-body h2 .octicon-link,
.markdown-body h3 .octicon-link,
.markdown-body h4 .octicon-link,
.markdown-body h5 .octicon-link,
.markdown-body h6 .octicon-link {
  display: none;
  color: #000;
  vertical-align: middle;
}

.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor,
.markdown-body h5:hover .anchor,
.markdown-body h6:hover .anchor {
  height: 1em;
  padding-left: 8px;
  margin-left: -30px;
  line-height: 1;
  text-decoration: none;
}

.markdown-body h1:hover .anchor .octicon-link,
.markdown-body h2:hover .anchor .octicon-link,
.markdown-body h3:hover .anchor .octicon-link,
.markdown-body h4:hover .anchor .octicon-link,
.markdown-body h5:hover .anchor .octicon-link,
.markdown-body h6:hover .anchor .octicon-link {
  display: inline-block;
}

.markdown-body h1 {
  padding-bottom: 0.3em;
  font-size: 2.25em;
  line-height: 1.2;
  border-bottom: 1px solid #eee;
}

.markdown-body h2 {
  padding-bottom: 0.3em;
  font-size: 1.75em;
  line-height: 1.225;
  border-bottom: 1px solid #eee;
}

.markdown-body h3 {
  font-size: 1.5em;
  line-height: 1.43;
}

.markdown-body h4 {
  font-size: 1.25em;
}

.markdown-body h5 {
  font-size: 1em;
}

.markdown-body h6 {
  font-size: 1em;
  color: #777;
}

.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
  margin-top: 0;
  margin-bottom: 16px;
}

.markdown-body hr {
  height: 4px;
  padding: 0;
  margin: 16px 0;
  background-color: #e7e7e7;
  border: 0 none;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
}

.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
  margin-top: 0;
  margin-bottom: 0;
}

.markdown-body li>p {
  margin-top: 16px;
}

.markdown-body dl {
  padding: 0;
}

.markdown-body dl dt {
  padding: 0;
  margin-top: 16px;
  font-size: 1em;
  font-style: italic;
  font-weight: bold;
}

.markdown-body dl dd {
  padding: 0 16px;
  margin-bottom: 16px;
}

.markdown-body blockquote {
  padding: 0 15px;
  color: #777;
  border-left: 4px solid #ddd;
}

.markdown-body blockquote>:first-child {
  margin-top: 0;
}

.markdown-body blockquote>:last-child {
  margin-bottom: 0;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow: auto;
  word-break: normal;
  word-break: keep-all;
}

.markdown-body table th {
  font-weight: bold;
}

.markdown-body table th,
.markdown-body table td {
  padding: 6px 13px;
  border: 1px solid #ddd;
}

.markdown-body table tr {
  background-color: #fff;
  border-top: 1px solid #ccc;
}

.markdown-body table tr:nth-child(2n) {
  background-color: #f8f8f8;
}

.markdown-body img {
  max-width: 100%;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.markdown-body code {
  padding: 0;
  padding-top: 0.2em;
  padding-bottom: 0.2em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(0,0,0,0.04);
  border-radius: 3px;
}

.markdown-body code:before,
.markdown-body code:after {
  letter-spacing: -0.2em;
  content: "\00a0";
}

.markdown-body pre>code {
  padding: 0;
  margin: 0;
  font-size: 100%;
  word-break: normal;
  white-space: pre;
  background: transparent;
  border: 0;
}

.markdown-body .highlight {
  margin-bottom: 16px;
}

.markdown-body .highlight pre,
.markdown-body pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f7f7f7;
  border-radius: 3px;
}

.markdown-body .highlight pre {
  margin-bottom: 0;
  word-break: normal;
}

.markdown-body pre {
  word-wrap: normal;
}

.markdown-body pre code {
  display: inline;
  max-width: initial;
  padding: 0;
  margin: 0;
  overflow: initial;
  line-height: inherit;
  word-wrap: normal;
  background-color: transparent;
  border: 0;
}

.markdown-body pre code:before,
.markdown-body pre code:after {
  content: normal;
}

.markdown-body .highlight {
  background: #fff;
}

.markdown-body .highlight .mf,
.markdown-body .highlight .mh,
.markdown-body .highlight .mi,
.markdown-body .highlight .mo,
.markdown-body .highlight .il,
.markdown-body .highlight .m {
  color: #945277;
}

.markdown-body .highlight .s,
.markdown-body .highlight .sb,
.markdown-body .highlight .sc,
.markdown-body .highlight .sd,
.markdown-body .highlight .s2,
.markdown-body .highlight .se,
.markdown-body .highlight .sh,
.markdown-body .highlight .si,
.markdown-body .highlight .sx,
.markdown-body .highlight .s1 {
  color: #df5000;
}

.markdown-body .highlight .kc,
.markdown-body .highlight .kd,
.markdown-body .highlight .kn,
.markdown-body .highlight .kp,
.markdown-body .highlight .kr,
.markdown-body .highlight .kt,
.markdown-body .highlight .k,
.markdown-body .highlight .o {
  font-weight: bold;
}

.markdown-body .highlight .kt {
  color: #458;
}

.markdown-body .highlight .c,
.markdown-body .highlight .cm,
.markdown-body .highlight .c1 {
  color: #998;
  font-style: italic;
}

.markdown-body .highlight .cp,
.markdown-body .highlight .cs {
  color: #999;
  font-weight: bold;
}

.markdown-body .highlight .cs {
  font-style: italic;
}

.markdown-body .highlight .n {
  color: #333;
}

.markdown-body .highlight .na,
.markdown-body .highlight .nv,
.markdown-body .highlight .vc,
.markdown-body .highlight .vg,
.markdown-body .highlight .vi {
  color: #008080;
}

.markdown-body .highlight .nb {
  color: #0086B3;
}

.markdown-body .highlight .nc {
  color: #458;
  font-weight: bold;
}

.markdown-body .highlight .no {
  color: #094e99;
}

.markdown-body .highlight .ni {
  color: #800080;
}

.markdown-body .highlight .ne {
  color: #990000;
  font-weight: bold;
}

.markdown-body .highlight .nf {
  color: #945277;
  font-weight: bold;
}

.markdown-body .highlight .nn {
  color: #555;
}

.markdown-body .highlight .nt {
  color: #000080;
}

.markdown-body .highlight .err {
  color: #a61717;
  background-color: #e3d2d2;
}

.markdown-body .highlight .gd {
  color: #000;
  background-color: #fdd;
}

.markdown-body .highlight .gd .x {
  color: #000;
  background-color: #faa;
}

.markdown-body .highlight .ge {
  font-style: italic;
}

.markdown-body .highlight .gr {
  color: #aa0000;
}

.markdown-body .highlight .gh {
  color: #999;
}

.markdown-body .highlight .gi {
  color: #000;
  background-color: #dfd;
}

.markdown-body .highlight .gi .x {
  color: #000;
  background-color: #afa;
}

.markdown-body .highlight .go {
  color: #888;
}

.markdown-body .highlight .gp {
  color: #555;
}

.markdown-body .highlight .gs {
  font-weight: bold;
}

.markdown-body .highlight .gu {
  color: #800080;
  font-weight: bold;
}

.markdown-body .highlight .gt {
  color: #aa0000;
}

.markdown-body .highlight .ow {
  font-weight: bold;
}

.markdown-body .highlight .w {
  color: #bbb;
}

.markdown-body .highlight .sr {
  color: #017936;
}

.markdown-body .highlight .ss {
  color: #8b467f;
}

.markdown-body .highlight .bp {
  color: #999;
}

.markdown-body .highlight .gc {
  color: #999;
  background-color: #EAF2F5;
}

.markdown-body .octicon {
  font: normal normal 16px octicons-anchor;
  line-height: 1;
  display: inline-block;
  text-decoration: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.markdown-body .octicon-link:before {
  content: '\f05c';
}

.markdown-body .task-list-item {
  list-style-type: none;
}

.markdown-body .task-list-item+.task-list-item {
  margin-top: 3px;
}

.markdown-body .task-list-item input {
  float: left;
  margin: 0.3em 0 0.25em -1.6em;
  vertical-align: middle;
}
table td{ word-wrap: break-word !important; word-break: break-all !important; }
/*

github.com style (c) Vasily Polovnyov <vast@whiteants.net>

*/

.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  color: #333;
  background: #f8f8f8;
  -webkit-text-size-adjust: none;
}

.hljs-comment,
.diff .hljs-header {
  color: #998;
  font-style: italic;
}

.hljs-keyword,
.css .rule .hljs-keyword,
.hljs-winutils,
.nginx .hljs-title,
.hljs-subst,
.hljs-request,
.hljs-status {
  color: #333;
  font-weight: bold;
}

.hljs-number,
.hljs-hexcolor,
.ruby .hljs-constant {
  color: #008080;
}

.hljs-string,
.hljs-tag .hljs-value,
.hljs-doctag,
.tex .hljs-formula {
  color: #d14;
}

.hljs-title,
.hljs-id,
.scss .hljs-preprocessor {
  color: #900;
  font-weight: bold;
}

.hljs-list .hljs-keyword,
.hljs-subst {
  font-weight: normal;
}

.hljs-class .hljs-title,
.hljs-type,
.vhdl .hljs-literal,
.tex .hljs-command {
  color: #458;
  font-weight: bold;
}

.hljs-tag,
.hljs-tag .hljs-title,
.hljs-rule .hljs-property,
.django .hljs-tag .hljs-keyword {
  color: #000080;
  font-weight: normal;
}

.hljs-attribute,
.hljs-variable,
.lisp .hljs-body,
.hljs-name {
  color: #008080;
}

.hljs-regexp {
  color: #009926;
}

.hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.lisp .hljs-keyword,
.clojure .hljs-keyword,
.scheme .hljs-keyword,
.tex .hljs-special,
.hljs-prompt {
  color: #990073;
}

.hljs-built_in {
  color: #0086b3;
}

.hljs-preprocessor,
.hljs-pragma,
.hljs-pi,
.hljs-doctype,
.hljs-shebang,
.hljs-cdata {
  color: #999;
  font-weight: bold;
}

.hljs-deletion {
  background: #fdd;
}

.hljs-addition {
  background: #dfd;
}

.diff .hljs-change {
  background: #0086b3;
}

.hljs-chunk {
  color: #aaa;
}


</style>
<style> @media print{ .hljs{overflow: visible; word-wrap: break-word !important;} }</style>
</head>
<body>
	<div class="page">
		<!--header begin-->
		<header>
			<div class="bigcontainer">
				<div id="logo">
					<a href="/">STAT HUB 应用管理</a>
				</div>
				<div class="user">
					<div class="ui compact notif menu">
						<a class="item" href="notifications.html">
							<i class="mail large icon"></i>
							<span id="message_count" class="circular floating ui small red label"></span>
						</a>
					</div>
					<div class="ui icon top right dropdown">
						<a href="user_profile.html">
							<img class="ui avatar image" src="resource/images/avatar-default.gif"/>
							欢迎，管理员
						</a>
					</div>
				</div>
			</div>
		</header>
		<!-- the main menu-->
		<div class="ui teal inverted menu">
			<div class="bigcontainer">
				<div class="right menu">
					<a class="item" href="/"><i class="home icon"></i>管理首页</a>
					<a class="item" href="node_list.html"><i class="sitemap icon"></i>节点</a>
					<a class="item" href="app_list.html"><i class="cloud icon"></i>应用</a>
					<a class="active item" href="help.html"><i class="help icon"></i>帮助</a>
					<a class="item" href="api_doc.html"><i class="info icon"></i>API接口</a>
				</div>
			</div>
		</div>
		<!--the main content begin-->
		<div class="container">
			<!--the content-->
			<div class="ui grid">
				<!--the vertical menu-->
				<div class="four wide column">
					<div class="verticalMenu">
						<div class="ui vertical pointing menu fluid">
							<a class="teal item" href="#1">
								<i class="icon"></i> 简要说明
							</a>
							<a class="teal item" href="#2">
								<i class="icon"></i> 运行环境
							</a>
							<a class="teal item" href="#3">
								<i class="icon"></i> 构建下载
							</a>
							<a class="teal item" href="#4">
								<i class="icon"></i> 启动运行
							</a>
							<a class="teal item" href="#5">
								<i class="icon"></i> 开始使用
							</a>
						</div>
					</div>
				</div>
				<!--the App list-->
				<div class="twelve wide column">
<div class="markdown-body">
<p><a name="1"></a></p>

<h2 id="toc_1">1.简要说明</h2>

<p>STAT hub是一个集群管理/应用编排/进程守护工具，可以用来高效的管理服务集群。功能有：</p>

<ul>
<li>节点管理：管理集群中的节点，掌握节点的状态，了解每个节点上运行了哪些进程；</li>
<li>应用管理：创建和管理应用，制定应用的分配规则，了解进程的数量和分配情况。</li>
</ul>

<p>STAT hub分为master和agent两个部分。master提供应用操作界面，用户可以编排服务；agent运行在工作节点上，守护工作进程。master和agent之间使用HTTP协议通信。</p>

<p><a name="2"></a></p>

<h2 id="toc_2">2.运行环境</h2>

<ul>
<li>操作系统

<ul>
<li>master：基于纯Java环境，可以在大部分操作系统上运行：Windows、Linux、macOS</li>
<li>agent：Linux操作系统，内核版本2.6.24以上，x86或arm架构，32或64位都经过测试；</li>
</ul></li>
<li>基础环境：Java 1.8+</li>
</ul>

<p><a name="3"></a></p>

<h2 id="toc_3">3.构建下载</h2>

<p><a name="3.1"></a></p>

<h3 id="toc_4">3.1 源码编译</h3>

<p>代码地址：</p>

<p><a href="https://github.com/lane-cn/stat">https://github.com/lane-cn/stat</a></p>

<p>运行构建命令：</p>

<pre><code>mvn package
</code></pre>

<p>得到构建包：</p>

<ul>
<li>agent/target/stat-agent-1.0.0-SNAPSHOT.jar</li>
<li>server/target/stat-server-1.0.0-SNAPSHOT.jar</li>
</ul>

<p><a name="3.2"></a></p>

<h3 id="toc_5">3.2 下载</h3>

<p>下载构建包：</p>

<ul>
<li><a href="http://121.199.25.213/stat/stat-agent-1.0.0-SNAPSHOT.jar">http://121.199.25.213/stat/stat-agent-1.0.0-SNAPSHOT.jar</a></li>
<li><a href="http://121.199.25.213/stat/stat-server-1.0.0-SNAPSHOT.jar">http://121.199.25.213/stat/stat-server-1.0.0-SNAPSHOT.jar</a></li>
</ul>

<p><a name="4"></a></p>

<h2 id="toc_6">4.启动运行</h2>

<p><a name="4.1"></a></p>

<h3 id="toc_7">4.1 master</h3>

<p>启动master进程：</p>

<pre><code>java -jar stat-server-1.0.0-SNAPSHOT.jar
</code></pre>

<p>完整的启动参数：</p>

<table>
<thead>
<tr>
<th>参数</th>
<th>说明</th>
<th>默认值</th>
</tr>
</thead>

<tbody>
<tr>
<td>server.port</td>
<td>服务端口</td>
<td>51026</td>
</tr>
<tr>
<td>store.directory</td>
<td>数据存储路径</td>
<td>${HOME}/.stat_server</td>
</tr>
<tr>
<td>elastic.http.port</td>
<td>内置Elasticsearch存储端口（HTTP）</td>
<td>51027</td>
</tr>
<tr>
<td>elastic.tcp.port</td>
<td>内置Elasticsearch存储端口（TCP）</td>
<td>51028</td>
</tr>
</tbody>
</table>

<p>启动后在以下位置提供服务：</p>

<table>
<thead>
<tr>
<th>服务地址</th>
<th>说明</th>
</tr>
</thead>

<tbody>
<tr>
<td><a href="http://master:51026">http://master:51026</a></td>
<td>用户界面</td>
</tr>
<tr>
<td><a href="http://master:51026/_plugin/head">http://master:51026/_plugin/head</a></td>
<td>Elasticsearch数据管理界面</td>
</tr>
<tr>
<td><a href="http://master:51027">http://master:51027</a></td>
<td>Elasticsearch HTTP服务端口</td>
</tr>
<tr>
<td>tcp://master:51028</td>
<td>Elasticsearch TCP服务端口</td>
</tr>
</tbody>
</table>

<p><a name="4.2"></a></p>

<h3 id="toc_8">4.2 agent</h3>

<p>启动agent进程：</p>

<pre><code>java -jar stat-agent-1.0.0-SNAPSHOT.jar --master.address=http://master:51026
</code></pre>

<p>完整的启动参数：</p>

<table>
<thead>
<tr>
<th>参数</th>
<th>说明</th>
<th>默认值</th>
</tr>
</thead>

<tbody>
<tr>
<td>master.address</td>
<td>master位置。可以不指定，以独立模式运行</td>
<td></td>
</tr>
<tr>
<td>server.port</td>
<td>服务端口</td>
<td>51025</td>
</tr>
<tr>
<td>store.directory</td>
<td>数据存储路径</td>
<td>${HOME}/.stat_agent</td>
</tr>
<tr>
<td>agent.address</td>
<td>一般情况下agent可以自动报告自己的地址。在某些环境下无法获取正确的IP地址，需要指定agent.address参数</td>
<td></td>
</tr>
</tbody>
</table>

<p>启动后在以下位置提供服务：</p>

<table>
<thead>
<tr>
<th>服务地址</th>
<th>说明</th>
</tr>
</thead>

<tbody>
<tr>
<td><a href="http://agent:51025">http://agent:51025</a></td>
<td>用户界面</td>
</tr>
</tbody>
</table>

<p><a name="5"></a></p>

<h2 id="toc_9">5.开始使用</h2>

<p><a name="5.1"></a></p>

<h3 id="toc_10">5.1 节点</h3>

<p><a name="5.1.1"></a></p>

<h4 id="toc_11">5.1.1 定义</h4>

<p>agent启动后向master报告节点信息。节点信息如下：</p>

<pre><code>{
    &quot;hostname&quot;: &quot;hostname1&quot;,
    &quot;agentAddress&quot;: &quot;http://192.168.1.165:51025&quot;,
    &quot;os&quot;: {
        &quot;name&quot;: &quot;Mac OS X&quot;,
        &quot;version&quot;: &quot;10.13.1&quot;,
        &quot;cpus&quot;: 4,
        &quot;architecture&quot;: &quot;x86_64&quot;
    },    
    &quot;memory&quot;: {
        &quot;total&quot;: 8589934592,
        &quot;ram&quot;: 8589934592
    }, 
    &quot;networks&quot;: [{
            &quot;address&quot;: &quot;192.168.1.165&quot;,
            &quot;name&quot;: &quot;en4&quot;,
            &quot;mtu&quot;: 1500,
            &quot;broadcast&quot;: &quot;192.168.1.255&quot;,
            &quot;description&quot;: &quot;en4&quot;,
            &quot;distination&quot;: &quot;0.0.0.0&quot;,
            &quot;flags&quot;: 34915,
            &quot;hwaddr&quot;: &quot;00:9A:9F:9F:A6:EB&quot;,
            &quot;metric&quot;: 0,
            &quot;netmask&quot;: &quot;255.255.255.0&quot;,
            &quot;type&quot;: &quot;Ethernet&quot;
    }],
    &quot;disks&quot;: [{
            &quot;dirName&quot;: &quot;/&quot;,
            &quot;devName&quot;: &quot;/dev/disk1s1&quot;,
            &quot;flags&quot;: 0,
            &quot;option&quot;: &quot;rw,local,rootfs&quot;,
            &quot;sysTypeName&quot;: &quot;apfs&quot;,
            &quot;type&quot;: 1,
            &quot;typeName&quot;: &quot;none&quot;,
            &quot;total&quot;: 250790436864
        },{
            &quot;dirName&quot;: &quot;/private/var/vm&quot;,
            &quot;devName&quot;: &quot;/dev/disk1s4&quot;,
            &quot;flags&quot;: 0,
            &quot;option&quot;: &quot;rw,noexec,noatime,local&quot;,
            &quot;sysTypeName&quot;: &quot;apfs&quot;,
            &quot;type&quot;: 1,
            &quot;typeName&quot;: &quot;none&quot;,
            &quot;total&quot;: 250790436864
    }],
    &quot;tags&quot;: [
        &quot;appserver&quot;,
        &quot;ssd&quot;
    ]
}
</code></pre>

<p>标签属性可以在用户界面上修改；其他信息是自动收集的，不用修改。</p>

<p><a name="5.1.2"></a></p>

<h4 id="toc_12">5.1.2 检索</h4>

<p>节点检索可以用来对节点进行查询和管理，也可以用来对进程运行位置进行规划。使用全文检索语法对节点进行检索，最简单的检索语法是一个词，比如<code>hostname1</code>、<code>appserver</code>。复杂一些的检索可以使用通配符，比如这个通配符，可以返回所有的节点：</p>

<pre><code>*
</code></pre>

<p>用这个通配符，可以返回所有以“hostname”开头的节点</p>

<pre><code>hostname*
</code></pre>

<p>可以使用通配符查询IP地址段：</p>

<pre><code>192.168.1.*
</code></pre>

<p>可以在查询语法中加上属性，这样查询更加精确：</p>

<pre><code>networks.address:192.168.1.165
</code></pre>

<p>可以准确指定一个地址段，这样：</p>

<pre><code>networks.address:[192.168.1.100 TO 192.168.1.150]
</code></pre>

<p>对数值属性可以查询数值范围，比如要查询CPU大于8核的节点：</p>

<pre><code>os.cpus:&gt;8
</code></pre>

<p>可以关联组合多个查询语法，比如要查询内存大于8G，并且地址在某个段内的节点，可以这样：</p>

<pre><code>memory.total:&gt;8000000000 AND networks.address:[192.168.1.100 TO 192.168.1.150]
</code></pre>

<p>可以用标签属性查询。为不同用途的节点添加标签，然后按照标签进行节点管理和应用编排，这是一个好办法：</p>

<pre><code>tags:appserver AND tags:hpc
</code></pre>

<p><a name="5.2"></a></p>

<h3 id="toc_13">5.2 应用</h3>

<p><a name="5.2.1"></a></p>

<h4 id="toc_14">5.2.1 部署</h4>

<p>应用是一个持续运行的服务，可以运行在多个节点上，每个节点上可以运行多个进程。应用定义了这些进程的启动运行参数。在STAT hub上部署一个应用：</p>

<pre><code>{
    &quot;name&quot;: &quot;http_server&quot;,
    &quot;toProcess&quot;: &quot;python&quot;,
    &quot;workingDirectory&quot;: &quot;/opt&quot;,
    &quot;envs&quot;: {
    },
    &quot;args&quot;: [
        &quot;http_server.py&quot;
    ],
    &quot;ports&quot;: [
        0,
        0
    ],
    &quot;killSignal&quot;: 15,
    &quot;uris&quot;: [
        &quot;http://121.199.25.213/stat/http_server.py&quot;
    ],
    &quot;healthChecks&quot;: [{
            &quot;initialDelaySeconds&quot;: 60,
            &quot;intervalSeconds&quot;: 20,
            &quot;maxConsecutiveFailures&quot;: 3,
            &quot;path&quot;: &quot;/&quot;,
            &quot;portIndex&quot;: 0,
            &quot;protocol&quot;: &quot;HTTP&quot;,
            &quot;timeoutSeconds&quot;: 20
    }],
    &quot;resAlloc&quot;: null
}
</code></pre>

<p><img src="https://raw.githubusercontent.com/lane-cn/stat/master/server/src/main/resources/META-INF/resources/images/new_app.png" alt=""/></p>

<p><code>http_server.py</code>是一个Python脚本，它启动一个HTTP监听端口。agent运行命令启动进程，在Linux环境下，命令会封装成<code>/bin/sh -c python http_server.py 8080</code>形式。进程启动后，agent会获取进程的<code>stderr</code>和<code>stdout</code>输出流。</p>

<p>agent在启动前会检查<code>uri</code>指定的位置。如果有更新的文件，把文件下载到本地工作目录。如果文件是<code>*.zip</code>格式，agent会尝试对文件进行解压。</p>

<p>可以指定进程使用的端口。<code>0</code>表示随机端口，由agent选择。多个端口输入的时候用逗号（半角）分隔。</p>

<p>agent对进程健康情况进行检查。进程启动60秒后，每隔20秒对第0个端口发起一个HTTP请求，检查请求的返回代码。如果连续3次返回错误代码，就杀死进程重新启动。</p>

<p>agent为进程分配必要的资源，包括内存、CPU核数、磁盘空间。//TODO 资源分配未实现</p>

<p><a name="5.2.2"></a></p>

<h4 id="toc_15">5.2.2 编排</h4>

<p>编排是控制服务的运行位置和进程数量。</p>

<p><img src="https://raw.githubusercontent.com/lane-cn/stat/master/server/src/main/resources/META-INF/resources/images/app_choreo.png" alt=""/></p>

<p>运行节点控制服务运行的位置，输入节点检索条件，默认的条件是<code>*</code>，代表所有节点。计划进程数控制服务运行的进程数。</p>

<p>应用启动后，master会按照编排规则自动分配服务进程。</p>

</div>
				</div>
			</div>
		</div>	
	</div>
	<!--footer begin-->
	<footer>
		<div id="copyrights">
			<div class="inset">
				<div class="bigcontainer">
					<div class="fl">
						<div class="logo"></div>
						<p>&copy; 2014 lane.cn@gmail.com <a href="https://github.com/lane-cn/stat" target="_blank">https://github.com/lane-cn/stat</a></p>
					</div>
				</div>
			</div>
		</div>
	</footer>
</body>
</html>
